package StreamDemo;



import org.junit.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Stream01 {
    public static void main(String[] args) {
       /* ArrayList<String> al = new ArrayList<>();
        al.add("1.txt");
        al.add("2.txt");
        al.add("3.pdf");
        al.add("4.docx");

        int count = 0;
        for(String s : al){
            if(s.endsWith(".txt")){
                count++;
            }

        }
        System.out.println(count);*/

        List<String> list = Arrays.asList("1.txt","2.txt","3.pdf","4.docx");
        long count = list.stream().filter(ele -> ele.endsWith(".txt")).count();
        System.out.println(count);


    }

    }





